<template>
    <teleport to="#back">
        <div class="Loading-container d-flex justify-content-center align-items-center h-100 w-100">
            <div class="Loading-content">
                <div class="spinner-border text-secondary" role="status">
                    <span class="visually-hidden">{{ 'Loading...' || text }}</span>
                </div>
                <p v-if="text" class="text-secondary small">{{ text }}</p>
            </div>
        </div>
    </teleport>
</template>
<script lang="ts">
import { defineComponent, onUnmounted } from 'vue'
import useDOMCreate from '@/hooks/useDOMCreate'
export default defineComponent({
    name: 'Loader',
    props: {
        text: {
            type: String
        }
    },
    setup() {
        useDOMCreate('back')
    }
})
</script>
<style>
.Loading-container {
    background-color: rgba(255, 255, 255, .5);
    z-index: 100;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
}

.Loading-content {
    text-align: center;
}
</style>
